package org.schemeway.plugins.schemescript;

import org.eclipse.debug.ui.*;
import org.eclipse.ui.*;
import org.eclipse.ui.console.*;
import org.schemeway.plugins.schemescript.interpreter.*;
import org.schemeway.plugins.schemescript.views.*;
/**
 * @author Nu Echo Inc.
 */
public class SchemePerspective implements IPerspectiveFactory {

	public SchemePerspective() {
		super();
	}

	public void createInitialLayout(IPageLayout layout) {
		defineActions(layout);
		defineLayout(layout);
	}

	private void defineLayout(IPageLayout layout) {
		String editorArea = layout.getEditorArea();

		IFolderLayout topLeft = layout.createFolder("topLeft", IPageLayout.LEFT, 0.20f, editorArea);
		topLeft.addView(SchemePackageExplorer.ID);
		
		IFolderLayout farRight = layout.createFolder("farRight", IPageLayout.RIGHT, 0.6f, editorArea);
		farRight.addView("org.eclipse.help.ui.HelpView.preLoaded");
		
		IFolderLayout bottomLeft = layout.createFolder("bottomLeft", IPageLayout.BOTTOM, 0.50f, "topLeft");
		bottomLeft.addView(IPageLayout.ID_OUTLINE);
		
		IFolderLayout bottomRight = layout.createFolder("bottomRight", IPageLayout.BOTTOM, 0.50f, editorArea);
		bottomRight.addView(IConsoleConstants.ID_CONSOLE_VIEW);
		bottomRight.addView(DefinitionListView.DEFINITION_LIST_ID);

		//layout.addFastView(DefinitionListView.DEFINITION_LIST_ID);
	}

	private void defineActions(IPageLayout layout) {
		// Add "new wizards".
		//layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.folder");//$NON-NLS-1$
		layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.project");//$NON-NLS-1$
		layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.file");
		layout.addNewWizardShortcut("org.schemeway.plugins.wizard.new.file");
		

		// Add "show views".
		//layout.addShowViewShortcut(IPageLayout.ID_RES_NAV);
		//layout.addShowViewShortcut(IPageLayout.ID_BOOKMARKS);
		//layout.addShowViewShortcut(IPageLayout.ID_PROP_SHEET);
		//layout.addShowViewShortcut(IPageLayout.ID_PROBLEM_VIEW);
		//layout.addShowViewShortcut(IPageLayout.ID_TASK_LIST);
		layout.addShowViewShortcut(SchemePackageExplorer.ID);
		layout.addShowViewShortcut("org.eclipse.help.ui.HelpView.preLoaded");
		layout.addShowViewShortcut(DefinitionListView.DEFINITION_LIST_ID);
		layout.addShowViewShortcut(IConsoleConstants.ID_CONSOLE_VIEW);
		layout.addShowViewShortcut(IPageLayout.ID_OUTLINE);
		

		layout.addActionSet(IPageLayout.ID_NAVIGATE_ACTION_SET);
	}
}
